// pages/check/check.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		state: '',
		http: getApp().globalData.map
	},
	onShow: function() {
		let that = this
		wx.getStorage({
			key: 'uid',
			success: (res) => {
				this.setData({
					uid: res.data
				})
				wx.request({
					url: getApp().globalData.chang + 'action=index&uid=' + that.data.uid.uid,
					success: (e) => {
						console.log(e)
						this.setData({
							data: e.data.data,
						})
					}
				})
				that.setData({
					zt: res.data.group_id
				})
			},
			fail: (e) => {
				wx.redirectTo({
					url: '../logs/logs'
				})
			}
		})
	},
	getScancode: function() {
		var _this = this;
		// 允许从相机和相册扫码
		wx.scanCode({
			success: (res) => {
				console.log(res.result.split('&'))
				let a = res.result.split('&')
				if (a.length < 2) {
					wx.showToast({
						icon: 'none',
						title: '二维码错误'
					})
				} else {
					wx.request({
						url: getApp().globalData.chang + 'action=saomahexiao&orderCode=' + a[0] + '&ItemID=' + a[1] + '&uid=' +
							_this.data.uid.uid,
						success: (e) => {
							console.log(e)
						}
					})
				}
			}
		})
	},
})
